#!/bin/ksh
#--------------------------------------------------------------
# Script Name : Backup the SIEBEL and ORACLE ROOT HOME 
# Created by  : hartlen
#         on  : 2009.09.15
# Updated by  : 
#         on  : 
# Parameters  : 
# Return Code : 0   = Normal End
# Comments    : 
#--------------------------------------------------------------
PATH=$PATH:/home/oracle/scripts ; export PATH
STATUS_DIR=/oracle/newbackup/BK_STATUS
BK_STATUS=/oracle/newbackup/log/BK_STATUS
BKUP=/oracle/newbackup
LOG=/tmp/Backup.log
MSG_LOG=/oracle/newbackup/log/joblog_`date +%Y%m`.log ;export MSG_LOG
JOBNAME=Backup_APP          ; export JOBNAME
DATE_FORMAT=`date +%Y%m%d`
ORACLE=/oracle/app/oracle
DAC=/oracle/app/DAC
BIEE=/oracle/app/OracleBI
BEDATA=/oracle/app/OracleBIData
INFORMATICA=/oracle/app/Informatica
ORADATA=/oracle/oradata/DWPROD
RC_CHK()
{
RC=$1
NAME=$2
if [[ $RC != 0 ]]
  then
      MSG_JOB E "Tar Err($RC) $NAME"
      exit 1
  else
      MSG_JOB I "Tar $NAME successfully"
fi
}
#----------------------
# delete yestoday backup
#----------------------

MYDEL

MSG_JOB S 
# Disk Backup -------------------------------------------------------
cd $BKUP
(/bin/tar cvzpf - -C / .$ORACLE | split -b 2000m - CRMBI_Oracle_$DATE_FORMAT.tar.gz. ) >$LOG 2>&1
RC=$?; RC_CHK $RC $ORACLE
(/bin/tar czvpf - -C / .$DAC | split -b 2000m - CRMBI_DAC_$DATE_FORMAT.tar.gz. ) >>$LOG 2>&1
RC=$?; RC_CHK $RC $DAC
(/bin/tar cvzpf - -C / .$BIEE | split -b 2000m - CRMBI_BIEE_$DATE_FORMAT.tar.gz. ) >>$LOG 2>&1
RC=$?; RC_CHK $RC $BIEE
(/bin/tar cvzpf - -C / .$BEDATA | split -b 2000m - CRMBI_BEDATA_$DATE_FORMAT.tar.gz. ) >>$LOG 2>&1
RC=$?; RC_CHK $RC $BEDATA
(/bin/tar cvzpf - -C / .$INFORMATICA | split -b 2000m - CRMBI_INFORMATICA_$DATE_FORMAT.tar.gz. ) >>$LOG 2>&1
RC=$?; RC_CHK $RC $INFORMATICA
(/bin/tar cvzpf - -C / .$ORADATA | split -b 2000m - CRMBI_ORADATA_$DATE_FORMAT.tar.gz. ) >>$LOG 2>&1
RC=$?; RC_CHK $RC $ORADATA
# Disk Backup end ---------------------------------------------------

MSG_JOB N 
echo "Successfully" > $BK_STATUS

#MYFTP "*.tar.Z.*" >>$LOG 2>&1

